import axios from "../config.js";

/**
 * 分页查询区域信息
 * @returns {Promise<unknown>}
 */
export const findPage = data => {
  return axios({
    url: "/demo/area/findByPage",
    method: "get",
    params: data
  });
};

/**
 * 查询所有区域信息
 * @returns {Promise<unknown>}
 */
export const findAll = data => {
  return axios({
    url: "/demo/area/findAll",
    method: "post",
    params: data
  });
};

/**
 * 通过id查找单个数据信息
 * @returns {Promise<unknown>}
 */
export const findOne = (data) => {
  return axios({
    url: "/demo/area/findOne/" ,
    method: "post",
    data
  });
};



/**
 * 通过上传表格进行添加区域信息
 * @param data
 * @returns {Promise<unknown>}
 */
export const saveFromExcel = data => {
  return axios({
    url: "/demo/area/saveFromExcel",
    method: "post",
    data
  });
};
/**
 * 添加区域信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const save = data => {
  return axios({
    url: "/demo/area/save/" ,
    method: "post",
    data
  });
};
/**
 * 更新区域信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const update = data => {
  return axios({
    url: "/demo/area/update/" ,
    method: "post",
    data
  });
};

/**
 * 删除区域信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const del = (data) => {
  return axios({
    url: "/demo/area/delete/" ,
    method: "post",
    data
  });
};

/**
 * 删除选中区域信息
 * @param data
 * @returns {Promise | Promise<unknown>}
 */
export const delMgs = data => {
  return axios({
    url: "/demo/area/deleteMessages" ,
    method: "post",
    data
  });
};
